<template>
  <div>
    <div id="example" style="height: 400px"></div>
  </div>
</template>

<script setup lang="ts">
// 基本使用
// yarn add echarts
import * as echarts from "echarts";
import { onMounted } from "vue";
onMounted(() => {
  // 初始化一个 echars 实例
  const chart = echarts.init(document.getElementById("example")!);

  // 指定图表的配置项和数据
  var option = {
    title: {
      text: "ECharts 入门示例",
    },
    tooltip: {},
    legend: {
      data: ["销量", "销售额"],
    },
    xAxis: {
      data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"],
    },
    yAxis: {},
    series: [
      {
        name: "销量",
        type: "bar",
        data: [5, 20, 36, 10, 10, 20],
      },
      {
        name: "销量额",
        type: "pie",
        data: [55, 30, 76, 20, 15, 25],
        radius: [100, 200],
      },
    ],
  };

  chart.setOption(option);
});
</script>

<style scoped lang="less"></style>
